﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ElfTyping.General;
using Microsoft.Xna.Framework;
using ElfTyping.Animations;

namespace ElfTyping.States.GameState.Effects
{
    public class GameEffect
    {
        public GameScript Script { protected get; set; }

        protected float TimeLeft { get; set; }
        protected float TimeElapsed { get; private set; }
        protected Animation CurrentAnimation { get; set; }
        protected Rectangle DrawBox { get; set; }

        public bool IsDone 
        {
            get { return TimeLeft <= 0; }
        }

        public virtual void OnStart()
        {

        }

        public virtual void Tick(float dt)
        {
            TimeLeft -= dt;
            TimeElapsed += dt;

            if (CurrentAnimation != null)
            {
                CurrentAnimation.Advance(dt);
            }
        }

        public virtual void OnEnd()
        {

        }

        public virtual void Draw(Camera camera)
        {
            if (CurrentAnimation != null)
            {
                CurrentAnimation.Draw(camera, DrawBox);
            }
        }
    }
}
